// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class XCN : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 ID Number",1)]
  	    [HL7Field(HL7Version.v23, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 1, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST IDNumber {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 Family Name",2)]
  	    [HL7Field(HL7Version.v23, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 2, HL7Repeat.False, HL7Required.True,"FN")]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"FN")]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.False, HL7Required.True,"FN")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.False, HL7Required.True,"FN")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.False, HL7Required.True,"FN")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.False, HL7Required.True,"FN")]
	    public FN FamilyName {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 Given Name",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST GivenName {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 Middle Name Or Initial",4)]
  	    [HL7Field(HL7Version.v23, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST MiddleNameOrInitial {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 Suffix (e.g., JR or III)",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST SuffixegJRorIII {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 Prefix (e.g., DR)",6)]
  	    [HL7Field(HL7Version.v23, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 6, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST PrefixegDR {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 Degree (e.g., MD)",7)]
  	    [HL7Field(HL7Version.v23, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 7, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 7, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.False, HL7Required.True,"IS")]
		[DegreeLicenseCertificate]
	    public IS DegreeegMD {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 Source Table",8)]
  	    [HL7Field(HL7Version.v23, 8, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v27, 8, HL7Repeat.False, HL7Required.True,"CWE")]
		[CNIDSource]
	    public CWE SourceTable {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 Assigning Authority",9)]
  	    [HL7Field(HL7Version.v23, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v231, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v24, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.False, HL7Required.True,"HD")]
		[AssigningAuthority]
	    public HD AssigningAuthority {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("10 Name Type Code",10)]
  	    [HL7Field(HL7Version.v23, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 10, HL7Repeat.False, HL7Required.True,"ID")]
		[NameType]
	    public ID NameTypeCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("11 Identifier Check Digit",11)]
  	    [HL7Field(HL7Version.v23, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 11, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 11, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST IdentifierCheckDigit {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("12 code identifying the check digit scheme employed",12)]
  	    [HL7Field(HL7Version.v23, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 12, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 12, HL7Repeat.False, HL7Required.True,"ID")]
		[CheckDigitScheme]
	    public ID codeidentifyingthecheckdigitschemeemployed {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("13 Identifier Type Code",13)]
  	    [HL7Field(HL7Version.v23, 13, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v231, 13, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 13, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v25, 13, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 13, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 13, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 13, HL7Repeat.False, HL7Required.True,"ID")]
		[IdentifierType]
	    public ID IdentifierTypeCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("14 Assigning Facility",14)]
  	    [HL7Field(HL7Version.v23, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v231, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v24, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v25, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v251, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v26, 14, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v27, 14, HL7Repeat.False, HL7Required.True,"HD")]
	    public HD AssigningFacility {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("15 Name Representation Code",15)]
  	    [HL7Field(HL7Version.v231, 15, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 15, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 15, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 15, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 15, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 15, HL7Repeat.False, HL7Required.True,"ID")]
		[Nameaddressrepresentation]
	    public ID NameRepresentationCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("16 Name Context",16)]
  	    [HL7Field(HL7Version.v24, 16, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v25, 16, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v251, 16, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v26, 16, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 16, HL7Repeat.False, HL7Required.True,"CWE")]
		[NameContext]
	    public CWE NameContext {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("17 Name Validity Range",17)]
  	    [HL7Field(HL7Version.v24, 17, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v25, 17, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v251, 17, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v26, 17, HL7Repeat.False, HL7Required.True,"DR")]
	    public DR NameValidityRange {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("18 Name Assembly Order",18)]
  	    [HL7Field(HL7Version.v24, 18, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 18, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 18, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 18, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 18, HL7Repeat.False, HL7Required.True,"ID")]
		[NameAssemblyOrder]
	    public ID NameAssemblyOrder {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("19 Effective Date",19)]
  	    [HL7Field(HL7Version.v25, 19, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 19, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 19, HL7Repeat.False, HL7Required.True,"DTM")]
  	    [HL7Field(HL7Version.v27, 19, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM EffectiveDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("20 Expiration Date",20)]
  	    [HL7Field(HL7Version.v25, 20, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 20, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 20, HL7Repeat.False, HL7Required.True,"DTM")]
  	    [HL7Field(HL7Version.v27, 20, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM ExpirationDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("21 Professional Suffix",21)]
  	    [HL7Field(HL7Version.v25, 21, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 21, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 21, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 21, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST ProfessionalSuffix {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("22 Assigning Jurisdiction",22)]
  	    [HL7Field(HL7Version.v25, 22, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v251, 22, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v26, 22, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 22, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE AssigningJurisdiction {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("23 Assigning Agency or Department",23)]
  	    [HL7Field(HL7Version.v25, 23, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v251, 23, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v26, 23, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 23, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE AssigningAgencyorDepartment {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("24 Security Check",24)]
  	    [HL7Field(HL7Version.v27, 24, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST SecurityCheck {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("25 Security Check Scheme",25)]
  	    [HL7Field(HL7Version.v27, 25, HL7Repeat.False, HL7Required.True,"ID")]
		[SecurityCheckScheme]
	    public ID SecurityCheckScheme {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
		    dataTypeParts.Add(IDNumber);
			dataTypeParts.Add(GetER7TextForDataPart(FamilyName, options));
		    dataTypeParts.Add(GivenName);
		    dataTypeParts.Add(MiddleNameOrInitial);
		    dataTypeParts.Add(SuffixegJRorIII);
		    dataTypeParts.Add(PrefixegDR);
		    dataTypeParts.Add(DegreeegMD);
			dataTypeParts.Add(GetER7TextForDataPart(SourceTable, options));
			dataTypeParts.Add(GetER7TextForDataPart(AssigningAuthority, options));
		    dataTypeParts.Add(NameTypeCode);
		    dataTypeParts.Add(IdentifierCheckDigit);
		    dataTypeParts.Add(codeidentifyingthecheckdigitschemeemployed);
		    dataTypeParts.Add(IdentifierTypeCode);
			dataTypeParts.Add(GetER7TextForDataPart(AssigningFacility, options));
		    dataTypeParts.Add(NameRepresentationCode);
			dataTypeParts.Add(GetER7TextForDataPart(NameContext, options));
			dataTypeParts.Add(GetER7TextForDataPart(NameValidityRange, options));
		    dataTypeParts.Add(NameAssemblyOrder);
			dataTypeParts.Add(GetER7TextForDataPart(EffectiveDate, options));
			dataTypeParts.Add(GetER7TextForDataPart(ExpirationDate, options));
		    dataTypeParts.Add(ProfessionalSuffix);
			dataTypeParts.Add(GetER7TextForDataPart(AssigningJurisdiction, options));
			dataTypeParts.Add(GetER7TextForDataPart(AssigningAgencyorDepartment, options));
		    dataTypeParts.Add(SecurityCheck);
		    dataTypeParts.Add(SecurityCheckScheme);
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

